﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class message : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            banddate();
        }

    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void banddate()
    {
        string str = "select subject,message_time from  messagebox order by message_time desc;";
        //string str = "SELECT   subject,message_time FROM  messagebox ";
        DataSet ds = new DataSet();
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["medical"].ConnectionString);
        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter(str, con);
        sda.Fill(ds);
        this.GridView1.DataSource = ds;
        this.DataBind();
        con.Close();
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string subject = this.GridView1.DataKeys[e.RowIndex].Value.ToString();
        Session["subject"] = subject;
        //Server.Transfer("news.aspx");
        // Response.Write("<script type=\"text/javascript\">top.location.href=\"news.aspx\";</script>");
        Response.Write("<script type=\"text/javascript\">window.open('newscontent.aspx','_blank');</script>");
        //<input type="button" name="jump" value="跳转" onclick="javascript:window.open('http://www.baidu.com','_blank')"> 
    }
    protected void Button1_Click(object sender, EventArgs e)
    {

    }
}
